package com.zhuiyun.project.api.personmessage.contorller;

import com.zhuiyun.project.api.personmessage.service.PersonMessageService;
import com.zhuiyun.project.common.response.CommonResult;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName PersonMessageController
 * @Description TODO
 * @Author kdj
 * @Date 2023/6/27 14:30
 **/
@RestController
@CrossOrigin
@RequestMapping("/person")
public class PersonMessageController {
    @Autowired
    private PersonMessageService personMessageService;

    /**
     * @param fromId
     * @param toId
     * @Author kdj
     * @Description 获取单聊的聊天记录
     * @Date 2023/6/27 19:09
     * @Return com.zhuiyun.project.common.response.CommonResult
     */
    @GetMapping("/getChatRecord")
    @ApiOperation(value = "获取单聊的聊天记录1")
    public CommonResult getChatRecord(int fromId, int toId) {
        return personMessageService.getChatRecord(fromId, toId);
    }

    /**
     * @param fromId
     * @param toId
     * @Author kdj
     * @Description 清空未读信息
     * @Date 2023/6/28 15:39
     * @Return com.zhuiyun.project.common.response.CommonResult
     */
    @GetMapping("/cleanUnReadMsg")
    @ApiOperation(value = "清空未读信息")
    public CommonResult cleanUnReadMsg(int fromId, int toId) {
        return personMessageService.cleanUnReadMsg(fromId, toId);
    }
}
